using Godot;
using System;

namespace Box;
public partial class NumberPropertyControl : HBoxContainer,IProperty
{
	public double pvalue = 0;
	public object PValue {
		get {
			
			if(input == null) return pvalue;
			return input.Value;
		}

		set {
			if(input == null) {
				pvalue = (Double)value;
				return;
			}
			input.Value = (Double)value;
		}
	}

	public string PName {get;set;}

	SpinBox input;
	Label label;

	public override string ToString() {
		return PValue.ToString();
	}
	public override void _Ready()
	{
		input = GetNode<SpinBox>("Input");
		label = GetNode<Label>("Label");
		label.Text = PName;
		input.Value = (Double)PValue;
	}
}
